package controller;

import Utils.ConstantUtils;
import Utils.ResponseData;
import com.baomidou.dynamic.datasource.annotation.DS;
import entity.SysAccounts;
import entity.SysPermission;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import service.SysPermissionService;
import vo.SysMenuVo;

import javax.annotation.Resource;
import java.util.List;

/**
 * 权限(SysPermission)表控制层
 *
 * @author liujh
 * @since 2020-08-10 17:01:04
 */
@Controller
@RequestMapping(value = "sysPermission",produces = "application/json;utf-8")
public class SysPermissionController {
    /**
     * 服务对象
     */
    @Resource
    private SysPermissionService sysPermissionService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public SysPermission selectOne(Long id) {
        return this.sysPermissionService.queryById(id);
    }


    @GetMapping("menu")
    @DS("db2")
    @ResponseBody
    public ResponseData findPermList(){
        List<SysMenuVo> permissionList = sysPermissionService.queryByList();
        return ResponseData.success(ConstantUtils.CODE_STATUS_SUCCESS,ConstantUtils.SUCCESS,permissionList);

    }


}